Skip to main content

Enterprise Wallet API Documentation

Introduction

Welcome to the OpenBlock developer documentation!

You can use the OpenBlock API to:

  • Create/approve transactions
  • Get enterprise wallet balance and transaction history
  • Receive webhook notifications for enterprise wallet related events
  • ......

Compared to traditional methods, the API allows for increased efficiency, reduced costs, and automation of enterprise wallet management.

Welcome to manage your wallet with the OpenBlock API. We provide comprehensive documentation and code samples, as well as professional technical support to assist you. The documentation is designed for developers worldwide to integrate with the platform.

Get Started

Overview

Please use a user account with enterprise wallet management to log in to OpenBlock and switch to the enterprise wallet, enter the enterprise wallet management page, manage payment plan, API account creation and Webhook configuration on the API tab in the left column. After the API account is successfully created, you can use the API Key to access the enterprise wallet API.


API Authentication

GET Request

GET request signing steps:

  1. Let all sent or received data be set M, and add a nonce parameter to set M, where nonce can be uuid.

  2. Sort the parameter values of the non-empty parameters in set M in ascending order by parameter name ASCII code (dictionary order), and concat them into a string stringA in the format of URL key-value pairs (i.e. key1=value1&key2=value2...).

    Special note:

    • Sort parameter names in ascending order by ASCII code (dictionary order)

    • Empty parameter values do not participate in signing

    • Parameter names are case sensitive

  3. Concat api_key to the end of stringA to get stringSignTemp string.

  4. Use api_secret to get the uppercase hex SHA256 string of stringA to get the sign value for the request.

  5. Concat &sign=sign after the stringSignTemp string to get the final signed string.

Example:

Suppose the user's api_key is: kkkkkkkkk, and api_secret is: ccccccccc. The original url of a request is openapi.openblock.com/api/v1/xxx?a=111&b=222&c=333

  1. Add nonce and sort to get stringA: a=111&b=222&c=333&nonce=09B7D140-9A8A-4D31-82CF-8B343B2301A7

  2. Concat api_key to stringA to get stringSignTemp: a=111&b=222&c=333&nonce=09B7D140-9A8A-4D31-82CF-8B343B2301A7&api_key=kkkkkkkkk

  3. Use api_secret to get uppercase hex SHA256 of stringSignTemp to get sign: 85F79F53AC252C8547CD2866C09BA9A6F66ABA0407E84E1DDAED16A97C9ACDC7

  4. Concat sign to stringSignTemp: a=111&b=222&c=333&nonce=09B7D140-9A8A-4D31-82CF-8B343B2301A7&api_key=kkkkkkkkk&sign=85F79F53AC252C8547CD2866C09BA9A6F66ABA0407E84E1DDAED16A97C9ACDC7

  5. Signing ends.


POST Request

POST request signing steps:

  1. Same as GET request.

  2. Put nonce, api_key, sign in body.

  3. If body is in JSON format, add corresponding key-value directly in JSON.

    Example:

    Suppose user's api_key is: kkkkkkkkk, api_secret is: ccccccccc. Body of a request is:

{
"a": "111",
"b": "222",
"c": "333"
}
  1. Add nonce and sort to get stringA: a=111&b=222&c=333&nonce=08AE0435-E68B-4460-835B-15475B58B75C

  2. Concat api_key to stringA to get stringSignTemp: a=111&b=222&c=333&nonce=08AE0435-E68B-4460-835B-15475B58B75C&api_key=kkkkkkkkk

  3. Use api_secret to get uppercase hex SHA256 of stringSignTemp to get sign: 7D2D6314B659E96A0A406C5837C94D0AC2901192BFEE2C03E7763D710525D980

  4. Rebuild JSON:

{
"a": "111",
"b": "222",
"c": "333",
"nonce":"08AE0435-E68B-4460-835B-15475B58B75C",
"api_key":"kkkkkkkkk",
"sign":"7D2D6314B659E96A0A406C5837C94D0AC2901192BFEE2C03E7763D710525D980"
}

Signing ends.


IP Whitelist

When calling the enterprise wallet API, only the IP whitelist addresses you set are allowed to initiate requests, and you need to set the IP address for calling when creating the API Key.


Request Base URL

https://auth.openblock.com

API List

Get company wallet information

API Description

TypePathMethod
Restful/openapi/company_wallet/info/GET

Input Parameters

None

Output

FieldTypeDescription
company_wallet_infoobjectCompany wallet information
--company_wallet_idstringCompany wallet id
--wallet_namestringCompany wallet name
--team_admin_membersintNumber of admin members
--policy_membersintNumber of policy members
rolestringUser role, enum value: ADMIN/SUPER_ADMIN/GENERAL
address_listlistChain address list
--chainstringChain name
--addressstringChain address
hd_wallet_listlistHd wallet list
--hd_wallet_idstringHd wallet id
--wallet_namestringHd wallet name

Successful Response Example

{
"company_wallet_info":{
"company_wallet_id":"xxx",
"wallet_name":"Company wallet 1",
"team_admin_members":2,
"policy_members":1
},
"role":"ADMIN",
"address_list":[
{
"chain":"ETH",
"address":"xxxxx"
},
{
"chain":"Polygon",
"address":"xxxxx"
}
],
"hd_wallet_list":[
{
"hd_wallet_id":"xxxx",
"wallet_name":"hd wallet 1"
},
{
"hd_wallet_id":"xxxx",
"wallet_name":"hd wallet2"
}
]
}

Error Response Example

{
"ok": false,
"err_msg": "xxxx",
"err_code": xxxx
}

Get company wallet hd-wallet address

API Description

TypePathMethod
Restful/openapi/company_wallet/hd_wallet_address/GET

Input Parameters

FieldRequiredTypeDescription
hd_wallet_idYesstringCompany wallet hd-wallet id

Output

FieldTypeDescription
address_listlistAddress list
--chainstringChain name
--addressstringChain address

Successful Response Example

{
"address_list":[
{
"chain":"ETH",
"address":"xxxxx"
},
{
"chain":"Polygon",
"address":"xxxxx"
}
]
}

Error Response Example

{
"ok": false,
"err_msg": "xxxx",
"err_code": xxxx
}

Get wallet balance

API Description

TypePathMethod
Restful/openapi/company_wallet/balance/GET

Input Parameters

ParameterRequiredTypeDefaultDescription
chain_nameYesstringBlockchain name
currencyNostringUSDBase currency, enum value: CNY, USD
hd_wallet_idNostringCompany wallet hd-wallet id, main wallet if not passed
pageNoint0Page number
limitNoint20Page size

Output

FieldTypeDescription
totalintTotal records
assetsarrayList of assets
- token_addressstringToken address
- balancestringBalance
- decimalintDecimal places
- symbolstringToken symbol
- currency_amountstringBalance converted to base currency
- pricestringUnit price

Successful Response Example

{
"total": 5,
"assets": [
{
"token_address": "",
"balance": "0.003904238820258",
"decimal": 18,
"symbol": "ETH",
"currency_amount": "7.038835022814874345458984375",
"price": "1802.8699951171875"
},
{
"token_address": "0xe3c408bd53c31c085a1746af401a4042954ff741",
"balance": "0",
"decimal": 8,
"symbol": "GMT2",
"currency_amount": "0",
"price": "0"
},
{
"token_address": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599",
"balance": "0",
"decimal": 8,
"symbol": "WBTC",
"currency_amount": "0",
"price": "26700"
},
{
"token_address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"balance": "0",
"decimal": 6,
"symbol": "USDC",
"currency_amount": "0",
"price": "1.0010000467300415"
}
]
}

Error Response Example

{
"ok": false,
"err_msg": "xxxx",
"err_code": "xxxx"
}

Add Custom Token

API Description

TypePathMethod
Restful/openapi/company_wallet/custom_token/POST

Input Parameters

ParameterRequiredTypeDescription
chain_nameYesstringBlockchain name
hd_wallet_idNostringCompany wallet hd-wallet id, main wallet if not passed
token_dataYesstringToken data in json object format, stringified
- addressYesstringToken contract address
- symbolYesstringToken symbol
- decimalsYesstringToken decimal places

Output

FieldTypeDescription
messagestringok

Input Example

{
"chain_name":"eth",
"token_data":"{\"address\": \"0x2260fac5e5542a773aa44fbcfedf7c193bc2c599\", \"symbol\": \"WBTC\", \"decimals\": \"8\"}"
}

Successful Response Example

{
"message": "ok"
}

Error Response Example

{
"ok": false,
"err_msg": "xxxx",
"err_code": "xxxx"
}

Transaction History

API Description

TypePathMethod
Restful/openapi/company_wallet/tx_history/GET

Input Parameters

ParameterRequiredTypeDescription
chain_nameYesstringBlockchain name
pageNointPage number, default 0
limitNointPage size, default 20
order_byNostringSort field, enum value: tx_time, block_number, default tx_time
ascNointSort order, 0 descending, 1 ascending, default 0
hd_wallet_idNostringCompany wallet hd-wallet id, main wallet if not passed

Output

FieldTypeDescription
pageintCurrent page number
limitintNumber of data per page
totalintTotal number of data
dataarrayTransaction record list
- record_idstringTransaction record ID
- block_hashstringBlock hash
- block_numberstringBlock height
- chain_namestringChain name
- transaction_hashstringTransaction hash
- transaction_typestringTransaction type
- contract_addressstringContract address
- statusstringStatus
- tx_timeintTransaction timestamp
- fromstringSource address
- tostringTarget address
- amountstringAmount
- fee_amountstringFee amount
- fee_datastringFee data
- dapp_datastringDapp data
- event_logstringEvent log
- parse_datastringParsed data
- client_datastringClient data
- operate_typestringOperate type
- transfer_idstringTransfer ID
- approve_logic_datastringApprove logic data
- company_wallet_approve_logic_datastringCompany wallet approve logic data
- memostringMemo

Successful Response Example

{
"page": 0,
"limit": 1,
// Total number of transaction history entries
"total": "6",
"data": [
{
"record_id": "1687743465",
"block_hash": "00000000031f2a40fc2741ee3c27484651e1052a99f9403d3ea08093fb99606f",
"block_number": "52374080",
"chain_name": "TRX",
"transaction_hash": "fee60897259e350c59805ac557019ade18e3c0971fa4d7528f74960ea2860d8a",
"transaction_type": "native",
"contract_address": "",
// Enumerated value: success,
"status": "success",
// Timestamp, in seconds
"tx_time": 1687743465,
"from": "TYuUmUBnqTGia5jjrmvUJieTUiTVvXEn4Z",
"to": "TSHGQ4sDHtYYawVuwAJh1d5yWc21BBonhE",
"amount": "1",
"fee_amount": "0",
"fee_data": "{\"energy_usage\":\"0\",\"fee_limit\":\"0\",\"net_usage\":\"265\"}",
"dapp_data": "",
"event_log": "",
"parse_data": "{\"token\":{\"address\":\"\",\"amount\":\"\",\"decimals\":0,\"symbol\":\"\"},\"tvm\":{}}",
"client_data": "",
"operate_type": "",
"transfer_id": "",
"approve_logic_data": "",
"company_wallet_approve_logic_data": null
},
]
}

Error Response Example

{
"ok": false,
"err_msg": "xxxx",
"err_code": xxxx
}

Get Approval List

Description

TypePathMethod
Restful/openapi/company_wallet/approvals/GET

Input Parameters

ParameterRequiredTypeDefaultDescription
pageNoint1Page number
limitNoint20Page size, max 20
statusNostringINGApproval status,ING:ing,FINISH:finished

Output

FieldTypeDescription
pageintCurrent page number
limitintNumber per page
dataarrayApproval record list
- cursorintRecord cursor
- record_idstringApproval record ID
- origin_record_idstringOriginal approval record ID
- my_statusstringMy approval status
- statusstringOverall approval status
- company_wallet_idstringEnterprise wallet ID
- hd_wallet_idstringhd wallet ID
- wallet_namestringEnterprise wallet name
- approve_typestringApproval type
- action_typestringAction type
- origin_user_uuidstringInitiator user ID
- origin_user_accountstringInitiator account
- create_timestringCreation time
- extra_dataobjectAdditional data
-- txinfoobjectTransaction information

Successful Response Example

{
"page": 3,
"limit": 1,
"data": [
{
"cursor": 28540,
"record_id": "7ce4b20f3d694ed38b74c1bf004a78e9",
"origin_record_id": "c4ee8c6b39844726a9216739f9cc211c",
"my_status": "REJECT",
"status": "REJECT",
"company_wallet_id": "81bb6cba42254be79aeabf5cfd23a90b",
"wallet_name": "企业钱包二期v1-1-1",
"approve_type": "TRANSACTION_APPROVE",
"action_type": "TRANSACTION",
"origin_user_uuid": "08f0d83dfe024d69af6bfaf9d5a592e4",
"origin_user_account": "P2",
"create_time": "2023-07-03 09:54:10",
"extra_data": {
"txinfo": {
"eip1559": true,
"to": "0xEC4fD89cf3aCf436Fe3be0310C3caa5834A04FE4",
"tokenAddress": "",
"from": "0xB2eC55D4756Ff87333bE6B7b7E273d5Cec0C9180",
"value": "0.00001",
"nonce": "34",
"gasLimit": "21000",
"gasPrice": "0",
"maxFeePerGas": "0.000000293",
"maxPriorityFeePerGas": "0.000000276",
"unit": "GWEI",
"shortHost": "",
"chain": "ETHGoerliTEST",
"isNative": true,
"token": {},
"data": "",
"google_record_id": "44e4fd99e91b4042af32836b884fca75",
"transaction_type": "native",
"isEnterpriseWallet": true,
"amount": "0.00001",
"symbol": "ETH",
"totalGas": "0.000000000006153",
"nativeCurrency": "ETH",
"txinput": {
"chainId": "BQ==",
"txMode": 1,
"maxInclusionFeePerGas": "ARQ=",
"maxFeePerGas": "ASU=",
"gasLimit": "Ugg=",
"nonce": "Ig==",
"transaction": {
"transfer": {
"amount": "CRhOcqAA"
}
},
"toAddress": "0xEC4fD89cf3aCf436Fe3be0310C3caa5834A04FE4"
},
"getPriceKey": "ethereum"
}
}
}
]
}

Error Response Example

{
"ok": false,
"err_msg": "xxxx",
"err_code": "xxxx"
}

Create Transaction Approval

API Description

API Description: Create Transaction Approval

TypePathMethod
restful/openapi/company_wallet/approval/new/POST

Input Parameters

ParameterRequiredTypeDescription
actionYesstringApproval type
TRANSACTION = "Transfer"
TRANSACTION_APPROVE = "Approval"
TRANSACTION_CONTRACT_INTERACTION = "Contract interaction"
hd_wallet_idNostringCompany wallet hd-wallet id, main wallet if not passed
txinfoYesstring (JSON object to string)Transaction parameters
--transaction_typeYesstringtransaction type
native: native transfer
transfer: token transfer
approve: token approve
contract: contract
transferNFT: nft transfer
approveNFT: nft approve
--chainYesstringChain name
Supports the following chains:
BTC
ETH
BSC
SUI
Aptos
DOGE
Kaspa
Solana
TRX
Cosmos
Osmosis
Conflux
ETC
LTC
OEC
HECO
Fantom
Polygon
Avalanche
Cronos
Klaytn
xDai
Optimism
Arbitrum
ArbitrumNova
zkSync
SmartBCH
Harmony
Ronin
Nervos
Casper
Polkadot
STC
ETHGoerliTEST
BSCTEST
SUITEST
zkSyncTEST
ScrollL2TEST
SeiTEST
evm210425
--fromYesstringSender address
--toNostringRecipient address
--tokenAddressNostringToken address, equired for token transfer, dapp deauthorization, nft transfer, and nft deauthorization
--valueNostringTransfer amount, required for native transfer, token transfer and nft transfer
--nonceNostringCustom nonce
--gasLimitNostringChain parameter gasLimit
--gasPriceNostringChain parameter gasPrice
--maxPriorityFeePerGasNostringChain parameter maxPriorityFeePerGas
--maxFeePerGasNostringChain parameter maxFeePerGas
--dataNostringDapp data, required for dapp authorization, nft authorization, and contract interaction
--pretreatment_valueNostringPre-transaction value, eth, bsc, arb, polygon these chains when the contract interaction,
If these chains do not fill in this value, the pre-transaction details cannot be resolved and will be approved according to the "Large Transaction Approval" (if any) approval flow.
--token_idNostringRequired for nft transfer
--dappInfoNoobjectDapp info
----originNostringDapp origin
----hrefNostringDapp href
----portNameNostringDapp port name
----iconNostringDapp icon
----dappNameNostringDapp name

Speed up and cancel input Parameters

ParameterRequiredType描述
txinfoYesstring (JSON object to string)Transaction parameters
--original_record_idYesstringOriginal transaction approval origin_record_id
--operate_typeYesstringOperate type, speed_up: speed up, cancel: cancel
--gasLimitNostringChain parameter gasLimit
--gasPriceNostringChain parameter gasPrice
--maxPriorityFeePerGasNostringChain parameter maxPriorityFeePerGas
--maxFeePerGasNostringChain parameter maxFeePerGas

Output

ParameterTypeDescription
origin_record_idstringApproval record ID of initiator
record_idintThe id of the approval details that are automatically passed, returned when there is an automatic pass
is_auto_passintWhether all pass automatically

Input Example

Native token transfer:

{
"action": "TRANSACTION",
"txinfo": JSON.stringify({
"chain": "HECO",
"from": "0x5adE66b500B80070F3280198CEBA2Af830D8e0ab",
"to": "0x7620E9bbb6591b9F53b6b5002B716B8D23ca3950",
"value": "0.01",
"gasLimit": "97839",
"gasPrice":"0",
"maxPriorityFeePerGas": "2.25",
"maxFeePerGas": "2.25"
})
}

ERC20 token transfer:

{
"action": "TRANSACTION",
"txinfo": JSON.stringify({
"to":"0x7620E9bbb6591b9F53b6b5002B716B8D23ca3950",
"tokenAddress":"0xa71edc38d189767582c38a3145b5873052c3e47a",
"from":"0x5adE66b500B80070F3280198CEBA2Af830D8e0ab",
"value":"0.0001",
"nonce":"14",
"gasLimit":"63262",
"gasPrice":"0",
"maxFeePerGas":"2.475",
"maxPriorityFeePerGas":"2.475",
"chain":"HECO"
})
}

dapp token approve

{
"action": "TRANSACTION_APPROVE",
# convert to json string
"txinfo":JSON.stringify({
"from":"0x5adE66b500B80070F3280198CEBA2Af830D8e0ab",
"to":"0xa71edc38d189767582c38a3145b5873052c3e47a", //token address
"nonce":"14",
"gasLimit":"97839",
"maxPriorityFeePerGas":"2.25",
"maxFeePerGas":"2.25",
"chain":"HECO",
"data":"0x00000000",
"dappInfo":{
"origin":"https://app.dodoex.io",
"href":"https://app.dodoex.io/?from=USDT&network=heco&to=HT",
"portName":"https://app.dodoex.io1689171704045",
"icon":"https://dashboard-assets.dappradar.com/geRRcWz9IdTwSrm1/document/14738/dodo-dapp-exchanges-ethereum-logo_13c0bed361114265825072e6b01a2c03.png",
"dappName":"DODO"
}
})
}

dapp contract

{
"action": "TRANSACTION_CONTRACT_INTERACTION",
# convert to json string
"txinfo":JSON.stringify({
"from":"0x5adE66b500B80070F3280198CEBA2Af830D8e0ab",
"to":"0xbc3a8f63f311f3b005ff8afc1a26272faaba8d36", //DAPP spender contract address
"nonce":"14",
"gasLimit":"354052",
"maxPriorityFeePerGas":"2.25",
"maxFeePerGas":"2.25",
"chain":"HECO",
"data":"0x301a3720000000000000000000000000",
"value":"0.0001",
"amount":"0.0001",
"dappInfo":{
"origin":"https://app.dodoex.io",
"href":"https://app.dodoex.io/?network=heco&from=HT&to=USDT",
"portName":"https://app.dodoex.io1689171328132",
"icon":"https://dashboard-assets.dappradar.com/geRRcWz9IdTwSrm1/document/14738/dodo-dapp-exchanges-ethereum-logo_13c0bed361114265825072e6b01a2c03.png",
"dappName":"DODO"
}
})
}

cancle token approve

action: TRANSACTION_APPROVE

txinfo:

{
"transaction_type": "approve",
"to": "0x000000000022D473030F116dDEE9F6B43aC78BA3",
"from": "0xd7f7Bf0dfCF8e6a3Fa9BB7013DcE5e3f6956c3cb", //DAPP spender contract address
"nonce": "16",
"gasLimit": "299979",
"gasPrice": "0.11",
"maxFeePerGas": "0",
"maxPriorityFeePerGas": "0",
"chain": "Arbitrum",
"isCancelTokenApprove": true,
"tokenAddress": "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8" // token address
}

NFT transfer

action: TRANSACTION

txinfo:

{
"transaction_type": "transferNFT",
"to": "0x27D25bBDA38F681c34A514E74D4e193BC1c2f19E",
"from": "0xd7f7Bf0dfCF8e6a3Fa9BB7013DcE5e3f6956c3cb",
"value": "1",
"nonce": "15",
"gasLimit": "130977",
"gasPrice": "6.2964",
"maxFeePerGas": "0",
"maxPriorityFeePerGas": "0",
"chain": "xDai",
"token_id": "51004",
"tokenAddress": "0xCF964c89f509a8c0Ac36391c5460dF94B91daba5" //NFT token address
}

NFT approve

action: TRANSACTION_APPROVE

txinfo:

{
"transaction_type": "approveNFT",
"to": "0x44b3f42e2bf34f62868ff9e9dab7c2f807ba97cb", // NFT contract address
"from": "0xd7f7Bf0dfCF8e6a3Fa9BB7013DcE5e3f6956c3cb",
"value": "0",
"nonce": "238",
"gasLimit": "60591",
"maxFeePerGas": "195.1387121",
"maxPriorityFeePerGas": "47.73988292",
"chain": "Polygon",
"data": "0x000000000",
"dappInfo": {
"origin": "https://opensea.io",
"href": "https://opensea.io/account",
"portName": "https://opensea.io1697038498545",
"icon": "https://dashboard-assets.dappradar.com/document/13/opensea-dapp-marketplaces-ethereum-logo_a3421ac6e32d529db3c8293f4cfa9bcd.png",
"tokenGasless": {},
"isBlackListedDapp": false,
"dappName": "OpenSea"
}
}

NFT cancle approve

action: TRANSACTION_APPROVE

txinfo:

{
"transaction_type": "approveNFT",
"to": "0x1E0049783F008A0085193E00003D00cd54003c71", //DAPP spender contract address
"from": "0xd7f7Bf0dfCF8e6a3Fa9BB7013DcE5e3f6956c3cb",
"value": "0",
"nonce": "242",
"gasLimit": "35396",
"gasPrice": "0",
"maxFeePerGas": "84.86624019",
"maxPriorityFeePerGas": "41.21511274",
"chain": "Polygon",
"tokenAddress": "0x44b3f42e2BF34F62868Ff9e9dAb7C2F807ba97Cb", //NFT token address
"isCancelTokenApprove": true
}

speed up

txinfo:

{
"gasLimit": "21000",
"gasPrice": "0",
"maxFeePerGas": "70",
"maxPriorityFeePerGas": "35",
"operate_type": "speed_up",
"original_record_id": "05104d9fe7c2410a95dd0261fc771111"
}

Successful Response Example

{
"ok": true,
"data": {
"origin_record_id": "xxxx", # Sponsor's approval record ID
"is_auto_pass": true, # Whether auto approved
"record_id": "xxx",
}
}

Error Response Example

{
"ok": false,
"err_msg": "xxxx",
"err_code": "xxxx"
}

Approve/Reject Approval

API Description

API Description: Approve/Reject Approval.

TypePathMethod
restful/openapi/company_wallet/approval/agree/POST

Input Parameters

ParameterRequiredTypeDescription
record_idYesstringApproval record ID, required for both agree and reject
agreeYesstringagree/reject

Success Response Example

{
"ok": true,
"data": {
"record_id": "xxxx",
"origin_record_id": "xxx", # Initiator's record ID
"status": "xxx",
}
}

Error Response Example

{
"ok": false,
"err_msg": "xxxx",
"err_code": xxxx
}

Webhook


Webhook Overview

Proactively notify events related to the enterprise wallet via webhook. Users can configure the webhook callback URL in the enterprise wallet API management page to receive notifications.


Request Description

Using the same authentication scheme as the API key, OpenBlock sends a POST request to the Webhook callback address configured by the user, and the Content-Type in the HTTP request header is application/json;charset=UTF-8. After receiving the Webhook push notification, the user needs to return a successful response (HTTP status code 200), and the content of the successful response is success; when the platform receives a non-successful status code, it will consider that the push failed and will retry the push again. The frequency of re-push is 30s, 1m, 5m, 1h, 12h, 24h.


Event Format

ParameterTypeDescription
event_typestringCallback event type
event_detailobjectCallback event details

Event Types

No.event_typeDescription
1CREATE_TRANSACTIONCreate transfer transaction (calling approval/new API)
2TRANSACTION_STATUS_CHANGETransaction status change (reject, all agree, etc)

Event_detail Parameter Description

ParameterTypeDescription
record_idstringApproval record ID
company_wallet_idstringCompany wallet ID
wallet_namestringCompany wallet name
action_typestringApproval type
TRANSACTION = "Transfer"
approve_typestringApproval decision type
SINGLE_APPROVE = 'Single approver'
DESCISION_APPROVE = 'Decision model approval'
ALL_ADMIN_APPROVE = 'All admins approval'
TRANSACTION_APPROVE = 'Transaction approval flow'
statusApproval status
ING = "Approving"
TRADING = "Agreed but action not taken" # Intermediate status for transaction approvals
AGREE = "Approved"
REJECT = "Rejected"
DELETED = "Deleted"
CANCEL = "Canceled"
AUTO_TRADING = "Auto approved, action not taken" # Intermediate status for transaction approvals
TIMEOUT = "Timed out"
extra_dataobjectAdditional data
--txinfoobjectTransaction parameters
agree_listlistApproved users list
ing_listobjectApproving users list

Txinfo Parameter Description

ParameterTypeDescription
fromstringSender address
tostringRecipient address
tokenAddressstringToken address
valuestringTransaction amount
noncestringNonce
gasLimitstringGas limit
gasPricestringGas price
maxFeePerGasstringMax fee per gas
maxPriorityFeePerGasstringMax priority fee per gas
chainstringChain name
isNativeboolIs native token
transaction_typestringTransaction type, native: native token transfer, transfer: token transfer
amountstringTransaction amount
symbolstringNative token symbol
nativeCurrencystringNative token name

Event_detail Example

{
"record_id": "672cbf141c0f4f988dec59678398a984",
"company_wallet_id": "2e3f75ebf9294fe68516f2d24cde74d3",
"wallet_name": "Enterprise Wallet 1",
"approve_type": "TRANSACTION_APPROVE",
"action_type": "TRANSACTION",
"status": "ING",
"is_simple_type": false,
"create_time": "2023-07-16 23:02:22",
"is_sponsor": true,
"approve_title_type": "TRADE_APPROVE_MODIFY",
"expired_time": null,
"extra_data": {
"txinfo": {
"eip1559": true,
"to": "0x27652D40eA3393caB38263A3Bdf268265dB00e42",
"tokenAddress": "",
"from": "0x5adE66b500B80070F3280198CEBA2Af830D8e0ab",
"value": "0.001",
"nonce": "38",
"gasLimit": "21000",
"gasPrice": "0",
"maxFeePerGas": "2.475",
"maxPriorityFeePerGas": "2.475",
"unit": "GWEI",
"shortHost": "",
"chain": "HECO",
"isNative": true,
"token": {},
"data": "",
"transaction_type": "native",
"isEnterpriseWallet": true,
"amount": "0.001",
"symbol": "HT",
"totalGas": "0.000051975",
"nativeCurrency": "HT",
"txinput": {
"chainId": "gA==",
"txMode": 1,
"maxInclusionFeePerGas": "k4WAwA==",
"maxFeePerGas": "k4WAwA==",
"gasLimit": "Ugg=",
"nonce": "Jg==",
"transaction": {
"transfer": {
"amount": "A41+pMaAAA=="
}
},
"toAddress": "0x27652D40eA3393caB38263A3Bdf268265dB00e42"
},
"getPriceKey": "huobi-token"
}
},
"origin_user_id": "dbfb1c42e43f4a80b22409e9a5707344",
"origin_user_account": "cc",
"agree_list": [
{
"user_id": "dbfb1c42e43f4a80b22409e9a5707344",
"account": "chen+6@gmail.com",
"nick_name": "cc",
"create_time": "2023-07-16 23:02:22",
"status": "init"
}
],
"ing_list": [
{
"node_name": "Node 1",
"valid_users_number": 2,
"total_users_number": 2,
"status": "ING",
"user_list": [
{
"user_id": "dbfb1c42e43f4a80b22409e9a5707344",
"account": "chenxxxx+6@gmail.com",
"nick_name": "cc",
"update_time": "2023-07-16 23:02:22",
"status": "AGREE"
},
{
"user_id": "00faf29f7d4744ee8a049110030a5cf3",
"account": "chenxxxx+2@gmail.com",
"nick_name": "jj",
"update_time": "2023-07-16 23:02:22",
"status": "ING"
}
]
}
]
}

Error Code

Error CodeError Description
68000General error code, error description view err_msg
50001Parameter error
50002Duplicate nonce request
50003Invalid API key
50004Unavailable API key
50005IP not allowed to access
50006Invalid request signature
50007Invalid wallet
50008User exception
50101Approval record does not exist
50102Approval record not approved
50103Original approval record completed

more coming soon

Docker API

This project aims to provide users with the ability to sendTransaction locally, so that users can deploy wallet services on their own servers, instead of using the wallet services provided by Openblock.

Start

First, make sure you have installed Docker, then execute the following commands:

docker pull openblock/openblock:1.0.0
docker run -p 7790:7790 -d openblock/openblock:1.0.0

Use

Enter http://localhost:7790, you will see the MPC unit import interface, follow the prompts to import your MPC unit, after the import is successful, you will see your enterprise wallet.

Signature interface

API Description
PathMethod
/openapi/sign/send_transactionPOST
Query Parameters
NameRequiredDescription
keytrueThe API_KEY applied by the enterprise wallet
Body Parameters
NameTypeRequiredDescription
company_wallet_approve_record_idstringtrueEnterprise wallet approval id
Successful Response Example
{
"code": 0,
"data": "",// txhash
}
Error Response Example
{
"code": 10001,
"message": "sign error"
}

API SDK

We provide API SDKs in golang/python:

Changelog

2023-12-28 v1.0.4

  • Added GoLang and Python SDK

2023-10-26 v1.0.3

  • Added support for company wallet hd wallet
  • Deleted Get all company wallets under a user account interface, Added Get company wallet information, Get company wallet hd-wallet address interfaces
  • Added support for creating speed up and cancel approval

2023-10-13 v1.0.2

  • Added support for evm dapp authorization, contract interaction, NFT authorization, and NFT transfer transaction types

2023-09-20 v1.0.1

  • Added docker image with send_transaction api (evm networks only)
  • Interface path prefix changed from /oopenapi/v1 to /openapi

2023-07-31 v1.0.0

  • Created API documentation
  • Added Get all company wallets under a user account, Get wallet balance, Add Custom Token, Transaction History, Get Approval List, Create Transaction Approval, Approve/Reject Approvalinterfaces